#ifndef __DLINK_H__
#define __DLINK_H__

typedef struct linknode{
	struct linknode *pre;
	struct linknode *next;
	char data[0];
}node_t;

typedef struct linklist{
	node_t head;
	int size;
}list_t;

typedef int(*cmp_t)(const void *data1, const void *data2);
typedef void(*pri_t)(const void *data1);

int list_init(list_t **mylist, int size);

int list_insert(list_t *mylist, const void *data);

int list_insert_tail(list_t *mylist, const void *data);

int list_is_empty(const list_t *mylist);

int list_delete(list_t *mylist, const void *key, cmp_t cmp);

int list_update(const list_t *mylist, const void *key, const void *data, cmp_t cmp);

void *list_search(const list_t *mylist, const void *key, cmp_t cmp);

void list_display(const list_t *mylist, pri_t pri);

void list_destroy(list_t **mylist);


#endif
